<template>
	<view>
		<u-notify ref="uNotify" message="Hi uView"></u-notify>
	</view>
</template>
<script>
	// import Notify from './wxcomponents/vant/notify/notify';
	export default {
		data() {
			return {
				pagepath:''
			}
		},
		onLaunch: function(option) {  
			console.log('App Launch')
			console.log(option.path,'当前页面路由');
			this.pagepath=option.path  
			// console.log(this.socket,20);
			
		},
		onShow: function() {
			console.log('App Show')
			this.socket.on('connect', () => {
				console.log('ws 已连接');
				
				if(uni.getStorageSync("userTel")){
					this.socket.emit('login', {
						loginer:uni.getStorageSync("userTel"),
					});
				}
				
			});
			//排除，站内信页面做单独处理
			if(this.pagepath!='pages/noticepage/noticepage'){
				this.socket.on('sysmsg', (msg) => {
					if(uni.getStorageSync('userTel')){
						console.log('站内信', msg);
						console.log(this.$refs);
						uni.showToast({
							title: '有新通知啦',
							image:'/static/xz.png',
							duration: 2000
						});
					}					
				});
			}
			
		},
		onHide: function() {
			console.log('App Hide')
		},
		onLoad() {
			
		}
	}
</script>

<style lang="scss">
	@import "uview-ui/index.scss";
	@import "/iconfont.wxss";
	@import "/wxcomponents/vant/common/index.wxss";
</style>
